package domain.controller;

import java.io.IOException;
import java.util.Date;
import java.util.List;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import domain.data.QnAPersistenceManager;
import domain.model.Domain;
import domain.service.Utils;


@SuppressWarnings("serial")
public class RssServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		resp.setContentType("text/plain");
		PersistenceManager psm = QnAPersistenceManager.get().getPersistenceManager();
		Date date_cache = new Date(new Date().getTime()+60*60*1000);
		
		resp.setHeader( "Cache-Control", "public, max-age=30");
		resp.setHeader( "Expires", date_cache.toGMTString() );
//		
//		Query query_article = psm.newQuery(Domain.class);
//		query_article.setOrdering("lastUpdateDate desc");
//		query_article.setRange(0, 30);
//		@SuppressWarnings({ "unchecked" })
//		List<Domain> listDomains = (List<Domain>) query_article.execute();
//		
//		req.setAttribute("listDomains", listDomains);
//		
//		req.setAttribute("title", "Analysis and evaluation of website information");
//		req.setAttribute("description",  Utils.ValidDomain()+" - A Free SEO tool that provides free website analysis, traffic details, rankings, contact email ,similar site, same owner site , same ip site, optimization and promotion reports.");
//		
//		try {
//			req.getRequestDispatcher("/rss.jsp").forward(req, resp);
//		} catch (ServletException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
	}

}
